//
//  Serialize.h
//  MPWeChat
//
//  Created by srulos on 2017/4/30.
//  Copyright © 2017年 srulos. All rights reserved.
//

#ifndef Serialize_h
#define Serialize_h

/* notification */
#define NOTIFICATION_APP_INFO_LOADED @"notification_app_info_loaded"
#define NOTIFICATION_UPDATE_QRCODE_STATUS @"notification_update_qrcode_status"
//#define NOTIFICATION_UPDATE_QRCODE_AVATAR @"notification_update_qrcode_avatar"

/* cache data dir */
#define CACHE_DATA_DIR @"resource_dir"

#define MP_POST_URL(_url)\
[NSString stringWithFormat:@"%@%@",MP_WECHAT_SERVER_URL,_url]

#define DECLEAR_POST_CB_FUNC(_func_name)\
-(void)_func_name:(WQHttpResult *)result backCode:(id)backCode;

#define DECLEAR_GETDATA_CB_FUNC(_func_name)\
-(void)_func_name:(NSData *)data backCode:(id)backCode;

#define POST_STRING(_url,_param,_delegate,_selector,_backCode)\
[[WQComplexHttpHelper standard]post:[NSString stringWithFormat:@"%@",_url] param:_param delegate:_delegate selector:_selector backCode:_backCode];

#define POST_STRING_REQUEST(_request,_delegate,_selector,_backCode)\
[[WQComplexHttpHelper standard]post:_request delegate:_delegate selector:_selector backCode:_backCode];

#define GET_DATA(_url,_delegate,_selector,_backCode)\
[[WQComplexHttpHelper standard] downLoadData:_url delegate:_delegate selector:_selector backCode:_backCode];

#define GET_CACHE_IMAGE_HTTP(_httpUrl,_imageView)\
[[WQCacheManager standard] getImage:_httpUrl imageView:_imageView scale:1.0];

#define GET_CACHE_IMAGE_HTTP_SCALE_CALL_BACK(_httpUrl,_imageView,_scale,_delegate,_selector,_backCode)\
[[WQCacheManager standard] getImage:_httpUrl imageView:_imageView scale:_scale delegate:_delegate selector:_selector backCode:_backCode];

#define GET_CACHE_IMAGE_HTTP_SCALE(_httpUrl,_imageView,_scale)\
[[WQCacheManager standard] getImage:_httpUrl imageView:_imageView scale:_scale];

#define GET_CACHE_DATA(_url,_delegate,_selector,_backCode)\
[[WQCacheManager standard] getData:_url delegate:_delegate selector:_selector backCode:_backCode];

#define ADD_OBSERVER(_id,_sel,_notificationName,_object)\
[[WQNotificationManager stander]addObserver:_id selector:_sel name:_notificationName object:_object];

#define REMOVE_OBSERVER(_id,_notificationName,_object)\
//[[NSNotificationCenter defaultCenter]removeObserver:_id name:_notificationName object:_object];

#define POST_NOTIFICATION(_notificationName,_object)\
[[WQNotificationManager stander]postNotification:_notificationName object:_object];

#define Nil2EmptyString(condition)\
if (condition == nil) {\
condition = @"";\
}

typedef enum QRCODE_STATUS
{
    QS_WAIT_SCAN = 1,
    QS_SCAN_SUCCESS = 2,
    QS_LOGIN_CANCEL = 3,
    QS_SCAN_EXPIRED = 4,
    QS_LOGIN_SUCCESS = 5
}QRCODE_STATUS;

#endif /* Serialize_h */
